home *** CD-ROM | disk | FTP | other *** search
- Path: ccshst05.cs.uoguelph.ca!ccshst01!jsadler
- From: jsadler@uoguelph.ca (J. Sadler)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: random number in assembly
- Date: 27 Mar 1996 22:21:34 GMT
- Organization: University of Guelph
- Message-ID: <4jcf1e$ftt@ccshst05.cs.uoguelph.ca>
- References: <Pine.NEB.3.91.960327200012.12939A-100000@dirty.cute.fi>
- NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- : Could someone tell me how to get a VERY WELL randomized number?
-
- srand(time(NULL)); /* seeds random sequence by # of seconds */
-
- will get u a very random seed point to create more random #'s from.
- there are many ways to create the random #:
-
- var=((rand()%high)+low; /* is one */
-
- i'll have to look up the 'classic' one: rand()?high+low-1
- there's one that works for decimal based rand sequences too.
- i also saw i quadratic one in some post here.
-
- concluding that i have a sever memory block
- at this time, i leave u in the hands of others.
-